$(function(){
	
	$("#newPlace").click(function(){
		$("#addPlace").slideToggle();
	});
	$("#close").click(function(){
		$("#addPlace").slideToggle();
	})

	$("#button").click(function(){
		var total = $("#total").text().split("￥")[1];
		var sum = $("#num").text()
		var caId = "";
		for(var i=0;i<$(".com").length;i++){
			if(i==$(".com").length-1){
				caId+=$(".com").eq(i).attr("name");
			}else{
				caId+=$(".com").eq(i).attr("name")+",";
			}
		}
		var user = $("#usMess").val();
		var phone = $("#phMess").val();
		var place = $("#plMess").val();
		$.post("MaClearingServlet",{action:"clearing",total:total,sum:sum,caId:caId,place:place,user:user,phone:phone},function(msg){
			eval("var mess="+msg);
			if(mess.msg=="ok"){
				$("#clear").slideToggle();
			}
		});
	});
})